let deviceWidth = document.body.clientWidth
$(document).ready(() => {
    // 准备完成后显示整个页面
    //页面显示过度动画插件
    new WOW().init()
    let clound = new URLSearchParams(location.search).get('clound')
    let key = new URLSearchParams(location.search).get('key')

    if (key !== 'safety') {
        var exampleSwiper = new Swiper(".platform-example-swiper", {
            slidesPerView: "auto",
            spaceBetween: deviceWidth > 768 ? 50 : 20,
        });
        var planSwiper = new Swiper(".plan-list-swiper", {
            on: {
                slideChange: function () {
                    var swiper = this;
                    console.log(swiper.activeIndex);
                    $('.plan-nav-list li').each(function () {
                        let id = $(this).data('id') * 1 - 1
                        $(this).removeClass('plan-active')
                        if (swiper.activeIndex === id) {
                            $(this).addClass('plan-active')
                        }
                    })
                }
            }
        });

        $('.plan-nav-list li').each(function () {
            $(this).on('click', function () {
                let id = $(this).data('id') * 1 - 1
                if (planSwiper) {
                    planSwiper.slideTo(id)
                }
            })
        })
    }
    function bindAPath() {
        localStorage.removeItem('path')
        $('a').each(function () {
            $(this).on('click', function (e) {
                localStorage.setItem('path', JSON.stringify({
                    name: document.title,
                    path: location.href
                }))
            })
        })
    }
    bindAPath()
    // 处理显示和隐藏
    if (clound) {
        $(`.${key}-box`).hide()
        $('.appli-item').each(function () {
            $(this).on('click', function () {
                $(this).siblings().removeClass('appli-show-item')
                $(this).addClass('appli-show-item')
            })
        })
        return
    }
    $(`.platform-cloud-box`).hide()

})